<template>
    <el-header>
      <div class="menufalg" @click="changing">
        <el-icon><Fold /></el-icon>
      </div>
      <div class="user">
        <img src="../../assets/image/daitu.jpg" alt="">
        <h4>FKM后台管理系统</h4>
        <el-button @click="cleartoken">退出登录</el-button>
      </div>
    </el-header>
</template>

<script setup lang="ts">
import { ref } from "vue"
import emitter from "../../utils/bus/emitter";
import {useLOGINStore} from '../../stores/loggin'
import router from '@/router';
const isCollapse = ref(false)
const changing = ()=>{
  if(isCollapse.value === false){
    isCollapse.value = true
  }else{
    isCollapse.value = false
  }
  // 前面是事件，后面是要传入的参数
  emitter.emit("isCollapse", isCollapse.value)
}
const cleartoken = ()=>{
  const userloginstore = useLOGINStore()
    userloginstore.token = ''
    userloginstore.menu = []
    router.push('/login')
}


</script>

<style scoped lang="less">
.el-header{
  display: flex;
  justify-content: space-between;
  .menufalg{
        width: 50px;
        height: 50%;
        background-color: #ffffff;
        display: flex;
        align-items: center;
        justify-content: center;
        // border: solid 1px #d9d9d9;
        border-right: solid 1px #d9d9d9;
        border-bottom: solid 1px #d9d9d9;
        border-bottom-right-radius: 5px;
        box-shadow: 2px 2px 2px #a09d9d;
  }
  .user{
    width: 300px;
    height: 60%;
    // background-color: aqua;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-right: 3%;
    img{
      width: 13%;
      height: 90%;
      border-radius: 50%;
    }
    .el-button{
      width: 100px;
      height: 80%;
    }
  }
}

</style>